package com.tqjc.system.system.wrapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.tqjc.system.common.Wrapper.BaseWrapper;
import com.tqjc.system.common.constant.ConfigConstant;
import com.tqjc.system.system.entity.SysConfigEntity;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 86195
 * @version 1.0
 * @description TODO
 * @date 2023/8/18 9:45
 */
public class ConfigInfoWrapper extends BaseWrapper<SysConfigEntity> {

    public ConfigInfoWrapper(IPage<SysConfigEntity> pageResult){
        super(pageResult);
        List<SysConfigEntity> records = pageResult.getRecords();
        List<SysConfigEntity> wrapperList = new ArrayList<SysConfigEntity>(records.size());
        for (SysConfigEntity record : records) {
            record.setConfigStatus(ConfigConstant.CONFIG_STATUS_EFFECTIVE.equals(record.getConfigStatus()) ?
                    ConfigConstant.CONFIG_EFFECTIVE_STR:ConfigConstant.CONFIG_UNEFFECTIVE_STR);
        }
        pageResult.setRecords(wrapperList);
    }
}
